package org.spring.oss;

import org.apache.commons.lang3.NotImplementedException;

import java.util.Objects;

public class OssFactory {
    public static IOss createOss(OssConfig ossConfig){
        IOss oss = null;
        switch (ossConfig.getOssType()){
            case "s3":{
                oss= new S3Oss();
                break;
            }
            case "minio":{
                oss= new MinIoOss();
                break;
            }
        }
        if (Objects.isNull(oss)) {
            throw new NotImplementedException(ossConfig.getOssType());
        }
        oss.setConfig(ossConfig);
        return oss;
    }
}
